#pragma once

#include "vector3.h"
#include "DisplayObject.h"
#include "HingeBar.h"
#include "Ball.h"

class CollisionTool
{
public:
	//ball hingebar interection
	static bool checkCollision( Ball ball, HingeBar bar ){
		bool doesCollide = false;


		if( doesCollide )
			Beep( 440, 500 );
		return doesCollide;
	}

	//ball linesegment intersection
	static bool checkCollision( Ball ball, vector3 p1, vector3 p2 )
	{
		vector3 d = p1 - ball.transform.position;
		double a = p2.dot( p2 );
		double b = d.dot( p2 );
		double c = d.dot( d ) - ball.radius * ball.radius;
		double disc = b * b - a * c;
		if( disc < 0 )
			return false;
		return true;
	}
};

